#pragma once
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include "MvCameraControl.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
//#define DEBUG
#include <stdio.h>
#ifdef DEBUG
#define DBGprint(...) printf(__VA_ARGS__)
#else
#define DBGprint(...)
#endif
using namespace cv;
enum ImageType{
    MONO,
    COLOR8,
};

class HkCameraHandler{
public:
    HkCameraHandler();
    ~HkCameraHandler();
    int start();
    /**
     * 触发的时候颜色的通道数需要指定
     */
    int TrrigerOnce(ImageType type);
    int getImageData(cv::Mat& outImage);
    int setExpouse(double val);
    int close();
private:
    int init();
    int ReadBuffer(void* Camerahandle, Mat &image , ImageType color_flag=MONO);

private:
    MV_CC_DEVICE_INFO_LIST stDeviceList;
    void* Camerahandle;
    unsigned char*  m_pBufForDriver;            // 用于从驱动获取图像的缓存
    cv::Mat tempImg;
    bool g_bExit;
};
